/*
 * ReceiptChecker.h
 *
 *  Created on: 2014. 1. 23.
 *      Author: mega
 */

#ifndef RECEIPTCHECKER_H_
#define RECEIPTCHECKER_H_

#include "../User.h"
#include "../NUtil/ThreadPool.h"

#include <string>
#include <vector>
#include <mutex>
#include <stack>

namespace ProjectZ { namespace NProcess {

class ReceiptChecker
{
public:
	struct Param
	{
		User * _user;

		int _result;
		int _buySeq;
		int _marketType;
		int _isGift;
		int _recvUserSeq;
		int _tid;
		int _errorCode;
		int _subErrorCode;

		std::string	_orderID;
		std::string	_purchase;
		std::string	_signature;
	};

public:
	ReceiptChecker();
	virtual ~ReceiptChecker();

public:
	void 	Push(Param & param);

private:
	void	work();
	void	OnEvent(Param & param, int ack, int validatorStatus);

private:
	std::deque<Param> 		_clsParamVector;
	NUtil::ThreadPool		_clsThreadPool;
	std::mutex 				_mutex;
};

} /*NProcess*/ } /*ProjectZ*/



#endif /* RECEIPTCHECKER_H_ */
